<?php
$this->breadcrumbs = $this->pageTitle = '我的订单';
if (count($model['GetUserOrderRsp']['list']) > 0): ?>
    <table width="100%" class="userorder tm10 titletable" cellspacing="0">
        <tr class="title">
            <td class="name">餐品</td><td class="price clbd_l">单价(元)</td><td class="amound clbd_l">数量</td><td class="totalprice clbd_l">实付款(元)</td><td class="productopt clbd_l">交易状态</td>
        </tr>
    </table>
    <table width="100%" class="userorder clbd_t hover-tbody" cellspacing="0">
        <?php
        foreach ($model['GetUserOrderRsp']['list'] as $key => $value) {
            $itemcount = count($value['orderItems']);
            ?>
            <tbody>
                <tr class="header">
                    <td colspan="6"><div class="z">订单号：<?php echo $value['id']; ?><span class="pipe">|</span>创建时间：<?php echo $value['createDate']; ?></div><div class="y">总金额：<span class="c_orange f_20">￥<?php echo number_format($value['totalPrice'],2); ?></span></div></td>
                </tr>
                <?php foreach ($value['orderItems'] as $ikey => $item) { ?>
                    <tr class="body<?php if ($itemcount == $ikey + 1): ?> orderlast<?php endif; ?>">
                        <td class="img"><a href="<?php echo Yii::app()->createUrl('product/' . $item['productSkuId']); ?>"><img src="<?php echo $item['img']; ?>" width="100"/></a></td><td class="name clbd_l"><a href="<?php echo Yii::app()->createUrl('product/' . $item['productSkuId']); ?>" target="_blank"><?php echo $item['productName']; ?></a><br/><br/><i><?php echo $item['sellerName']; ?></i></td><td class="price clbd_l">￥<?php echo number_format($item['price'], 2); ?></td><td class="amound clbd_l">×<?php echo $item['amount']; ?></td><td class="totalprice clbd_l">￥<?php echo number_format($item['price'] * $item['amount'], 2); ?></td><?php if ($ikey == 0): ?><td class="productopt" rowspan="<?php echo $itemcount; ?>"><?php echo $common->orderstatus($value['orderState'], $value['id']); ?></td><?php endif; ?>
                    </tr>
                <?php } ?>
                <tr class="seprow">
                    <td colspan="6"> </td>
                </tr>
            </tbody>
        <?php } ?>
    </table>
    <script>
        $(document).ready(function() {
            $(".hover-tbody > tbody").hover(function() {
                $(this).addClass("on");
            }, function() {
                $(this).removeClass("on");
            })
        });
    </script>
<?php else: ?>
    <div class="nfl">
        <div class="f_c altw">
            <div id="messagetext" class="alert_error">
                <p>购物车里没有东西哦<script type="text/javascript" reload="1">//setTimeout(\"window.location.href ='http://wh.whtaxi.com/zp/';\", 3000);</script></p>
                <p class="alert_btnleft"><a href="<?php echo Yii::app()->createUrl('site/index'); ?>">马上去点餐</a></p>
            </div>
        </div>
    </div>
<?php endif; ?>
